package Capitulo08;

public class Foo {


	/**
	 * Construtor da class Foo.
	 */
	Foo(){
		System.out.println("Foo");
	}
	
	/**
	 * Class interna Bar.
	 */
	class Bar{
		/**
		 * Construtor da class Bar.
		 */
		Bar(){
			System.out.println("bar");
		}
		
		public void go(){
			System.out.println("hi");
		}
	}
	
	public static void main(String[] args) {
		
		Foo f = new Foo();
		f.makeBar();
		
		Foo.Bar fb = new Foo().new Bar();
		fb.go();
		
		/**
		 * Instanciando o class Object e sobrescrevendo o metodo equals.
		 */
		Object o = new Object(){
			public boolean equals(Object obj){
				return true;
			}
		};
		System.out.println(o.equals("Fred"));
		
	}
	
	void makeBar(){
		(new Bar(){}).go();
	}
}
